package com.dl.user.controller;

import com.dl.common.core.response.Result;
import com.dl.common.security.vo.TokenInfoVO;
import com.dl.user.dto.UserDTO;
import com.dl.user.entity.User;
import com.dl.user.service.impl.UserServiceImpl;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserServiceImpl userService;


    /**
     * 注册用户
     * @return
     */
    @PostMapping("/reg")
    public Result<String> reg(@RequestBody User user){
        return userService.register(user);
    }

    /**
     *用户登录
     * @return
     */
    @PostMapping("/login")
    public Result<TokenInfoVO> login(@RequestBody UserDTO userDTO){
        return userService.login(userDTO);
    }





}
